JavaScript syntax
part 16/59 · 107.4 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
console.log(NaN !== NaN); // true
console.log(nan !== nan); // true
// Users can use the isNaN methods to check for NaN
console.log(isNaN("converted to NaN")); // true
console.log(isNaN(NaN)); // true
console.log(Number.isNaN("not converted")); // false
console.log(Number.isNaN(NaN)); // true
BigInt
In JavaScript, regular numbers are represented with the IEEE 754 floating point type, meaning integers can only safely be stored if the value falls between Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER. cite-ref-10[10] BigInts instead represent integers of any size, allowing programmers to store integers too high or low to be represented with the IEEE 754 format.cite-ref-bigint-mdn-11-0[11]
There are two ways to declare a BigInt value. An n can be appended to an integer, or the BigInt function can be used:cite-ref-bigint-mdn-11-1[11]
const a = 12345n; // Creates a variable and stores a BigInt value of 12345
const b = BigInt(12345);
String